#include <functional>
#include <vector>
#include <iostream>
#include <unistd.h>
#include <cassert>
using Task = std::function<void()>;

class TaskManager
{
public:
    void RegisterTask(Task&& task)
    {
        _Tasks.push_back(task);
    }

    int Size()
    {
        return _Tasks.size();
    }

    Task& GetTask(int code)
    {
        assert(code >= 0 && code < _Tasks.size());
        return _Tasks[code];
    }
private:
    std::vector<Task> _Tasks;
};